package clamtitdictionary;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
import java.util.*;
import java.io.*;


public class ITdictionary extends JFrame{
    JTextField 	searchTextField;
    JTextArea  	tipOftheDayTextArea;
    JTextArea	outputDefTextArea;
    JButton    	searchBtn;
    JButton 	clearBtn;
    JButton 	addTermBtn;
    JButton 	myTermsBtn;
    JButton 	helpBtn;
    JButton 	aboutBtn;
    JButton 	homeBtn;
    JButton		logoBtn;
    JLabel 		tipOfTheDay;
    JPanel 		headerPanel;
    JPanel 		indexPanel;
    JPanel 		tipOftheDayPanel;
    JPanel 		outputPanel;
    JPanel 		mainPanel;
    JPanel 		menuPanel;
    JPanel 		buttonsPanel;
    JPanel		logoPanel;
    JPanel		footerPanel;
    JScrollPane scrollPaneBody;
    JScrollPane scrollPaneTip;
    

    public ITdictionary() {
    	
    	
    	
    	Border empty = BorderFactory.createEmptyBorder();
    	Border loweredBevel = BorderFactory.createLoweredBevelBorder();
    	
        searchTextField = new JTextField(20);
		searchTextField.setText("I am looking for...");
        searchTextField.setFont(new Font("Lucida Console", Font.PLAIN, 25));
        searchTextField.selectAll();
        searchTextField.addMouseListener(new CursorListener());
        
        outputDefTextArea = new JTextArea(15, 80);
		outputDefTextArea.setFont(new Font("Lucida Console", Font.PLAIN, 18));
		
		
		tipOftheDayTextArea = new JTextArea(3, 80);
		tipOftheDayTextArea.setFont(new Font("Lucida Console", Font.PLAIN, 11));
		
		ImageIcon search = new ImageIcon("icons/Search.png");
		ImageIcon logoIcon = new ImageIcon("icons/ITlogo2.png");
		ImageIcon home = new ImageIcon("icons/home3.png");
		ImageIcon about = new ImageIcon("icons/aboutus2.png");
		ImageIcon help = new ImageIcon("icons/help2.png");
		ImageIcon add = new ImageIcon("icons/addterm.png");
		ImageIcon added = new ImageIcon("icons/myterms.png");
		ImageIcon clear = new ImageIcon("icons/ccleaner.png");
		//ImageIcon zz = new ImageIcon("icons/f.png");
		
		logoBtn = new JButton(logoIcon);
		logoBtn.setBackground(Color.white);
        logoBtn.setForeground(Color.black);
        logoBtn.setBorder(empty);
		
        searchBtn = new JButton(search);
        searchBtn.setBackground(Color.white);
        searchBtn.setForeground(Color.black);
        searchBtn.setBorder(empty);
        
        homeBtn = new JButton(home);
        homeBtn.setBackground(Color.white);
        homeBtn.setForeground(Color.black);
        homeBtn.setBorder(empty);
        
        aboutBtn = new JButton(about);
        aboutBtn.setBackground(Color.white);
        aboutBtn.setForeground(Color.black);
        aboutBtn.setBorder(empty);
        
        helpBtn = new JButton(help);
        helpBtn.setBackground(Color.white);
        helpBtn.setForeground(Color.black);
        helpBtn.setBorder(empty);

        addTermBtn = new JButton(add);
        addTermBtn.setBackground(Color.white);
        addTermBtn.setForeground(Color.black);
        addTermBtn.setBorder(empty);
        
        myTermsBtn = new JButton(added);
        myTermsBtn.setBackground(Color.white);
        myTermsBtn.setForeground(Color.black);
        myTermsBtn.setBorder(empty);
        
        clearBtn = new JButton(clear);
        clearBtn.setBackground(Color.white);
        clearBtn.setForeground(Color.black);
        clearBtn.setBorder(empty);
   
        
        JButton a = new JButton(new ImageIcon("icons/a.png"));
        a.setBackground(Color.LIGHT_GRAY);
        a.setForeground(Color.black);
        a.setBorder(empty);
        
        JButton b = new JButton(new ImageIcon("icons/b.png"));
        b.setBackground(Color.LIGHT_GRAY);
        b.setForeground(Color.black);
        b.setBorder(empty);
        
        JButton c = new JButton(new ImageIcon("icons/c.png"));
        c.setBackground(Color.LIGHT_GRAY);
        c.setForeground(Color.black);
        c.setBorder(empty);
        
        JButton d = new JButton(new ImageIcon("icons/d.png"));
        d.setBackground(Color.LIGHT_GRAY);
        d.setForeground(Color.black);
        d.setBorder(empty);
        
        JButton e = new JButton(new ImageIcon("icons/e.png"));
        e.setBackground(Color.LIGHT_GRAY);
        e.setForeground(Color.black);
        e.setBorder(empty);
        
        JButton f = new JButton(new ImageIcon("icons/f.png"));
        f.setBackground(Color.LIGHT_GRAY);
        f.setForeground(Color.black);
        f.setBorder(empty);
        
        JButton g = new JButton(new ImageIcon("icons/g.png"));
        g.setBackground(Color.LIGHT_GRAY);
        g.setForeground(Color.black);
        g.setBorder(empty);
        
        JButton h = new JButton(new ImageIcon("icons/h.png"));
        h.setBackground(Color.LIGHT_GRAY);
        h.setForeground(Color.black);
        h.setBorder(empty);
        
        JButton i = new JButton(new ImageIcon("icons/i.png"));
        i.setBackground(Color.LIGHT_GRAY);
        i.setForeground(Color.black);
        i.setBorder(empty);
        
        JButton j = new JButton(new ImageIcon("icons/j.png"));
        j.setBackground(Color.LIGHT_GRAY);
        j.setForeground(Color.black);
        j.setBorder(empty);
        
        JButton k = new JButton(new ImageIcon("icons/k.png"));
        k.setBackground(Color.LIGHT_GRAY);
        k.setForeground(Color.black);
        k.setBorder(empty);
        
        JButton l = new JButton(new ImageIcon("icons/l.png"));
        l.setBackground(Color.LIGHT_GRAY);
        l.setForeground(Color.black);
        l.setBorder(empty);
        
        JButton m = new JButton(new ImageIcon("icons/m.png"));
        m.setBackground(Color.LIGHT_GRAY);
        m.setForeground(Color.black);
        m.setBorder(empty);
        
        JButton n = new JButton(new ImageIcon("icons/n.png"));
        n.setBackground(Color.LIGHT_GRAY);
        n.setForeground(Color.black);
        n.setBorder(empty);
        
        JButton o = new JButton(new ImageIcon("icons/o.png"));
        o.setBackground(Color.LIGHT_GRAY);
        o.setForeground(Color.black);
        o.setBorder(empty);
        
        JButton p = new JButton(new ImageIcon("icons/p.png"));
        p.setBackground(Color.LIGHT_GRAY);
        p.setForeground(Color.black);
        p.setBorder(empty);
        
        JButton q = new JButton(new ImageIcon("icons/q.png"));
        q.setBackground(Color.LIGHT_GRAY);
        q.setForeground(Color.black);
        q.setBorder(empty);
        
        JButton r = new JButton(new ImageIcon("icons/r.png"));
        r.setBackground(Color.LIGHT_GRAY);
        r.setForeground(Color.black);
        r.setBorder(empty);
        
        JButton s = new JButton(new ImageIcon("icons/s.png"));
        s.setBackground(Color.LIGHT_GRAY);
        s.setForeground(Color.black);
        s.setBorder(empty);
        
        JButton t = new JButton(new ImageIcon("icons/t.png"));
        t.setBackground(Color.LIGHT_GRAY);
        t.setForeground(Color.black);
        t.setBorder(empty);
        
        JButton u = new JButton(new ImageIcon("icons/u.png"));
        u.setBackground(Color.LIGHT_GRAY);
        u.setForeground(Color.black);
        u.setBorder(empty);
        
        JButton v = new JButton(new ImageIcon("icons/v.png"));
        v.setBackground(Color.LIGHT_GRAY);
        v.setForeground(Color.black);
        v.setBorder(empty);
        
        JButton w = new JButton(new ImageIcon("icons/w.png"));
        w.setBackground(Color.LIGHT_GRAY);
        w.setForeground(Color.black);
        w.setBorder(empty);
        
        JButton x = new JButton(new ImageIcon("icons/x.png"));
        x.setBackground(Color.LIGHT_GRAY);
        x.setForeground(Color.black);
        x.setBorder(empty);
        
        JButton y = new JButton(new ImageIcon("icons/y.png"));
        y.setBackground(Color.LIGHT_GRAY);
        y.setForeground(Color.black);
        y.setBorder(empty);
        
        JButton z = new JButton(new ImageIcon("icons/z.png"));
        z.setBackground(Color.LIGHT_GRAY);
        z.setForeground(Color.black);
        z.setBorder(empty);
               

		
		indexPanel = new JPanel();
		//indexPanel.setLayout(new GridLayout(26 , 1 , 0 ,0));
		indexPanel.setLayout(new FlowLayout(FlowLayout.LEFT,0,0));
		indexPanel.setBackground(Color.LIGHT_GRAY);
		//indexPanel.add(new JLabel("Show all terms in this letter: "));
	
		indexPanel.add(a);
		indexPanel.add(b);
		indexPanel.add(c);
		indexPanel.add(d);
		indexPanel.add(e);
		indexPanel.add(f);
		indexPanel.add(g);
		indexPanel.add(h);
		indexPanel.add(i);
		indexPanel.add(j);
		indexPanel.add(k);
		indexPanel.add(l);
		indexPanel.add(m);
		indexPanel.add(n);
		indexPanel.add(o);
		indexPanel.add(p);
		indexPanel.add(q);
		indexPanel.add(r);
		indexPanel.add(s);
		indexPanel.add(t);
		indexPanel.add(u);
		indexPanel.add(v);
		indexPanel.add(w);
		indexPanel.add(x);
		indexPanel.add(y);
		indexPanel.add(z);
		
		//buttonsPanel = new JPanel();
		//buttonsPanel.setLayout(new FlowLayout(FlowLayout.RIGHT,0,0));
        //buttonsPanel.setBackground(Color.white);
        //buttonsPanel.add(addTermBtn);
        //buttonsPanel.add(myTermsBtn);
        //buttonsPanel.add(new JLabel(" "));
		//buttonsPanel.add(indexPanel);
		

		
		menuPanel = new JPanel();
        menuPanel.setLayout(new FlowLayout(FlowLayout.LEFT,0,0));
        menuPanel.setBackground(Color.LIGHT_GRAY);
        menuPanel.add(new JLabel("            "));
        menuPanel.add(homeBtn);
        menuPanel.add(addTermBtn);
        menuPanel.add(myTermsBtn);
        menuPanel.add(aboutBtn);
        menuPanel.add(helpBtn);
        menuPanel.add(new JLabel("           "));
        //menuPanel.add();
        //menuPanel.add(indexPanel);
		
		
		scrollPaneTip = new JScrollPane(tipOftheDayTextArea);
		scrollPaneBody = new JScrollPane(outputDefTextArea);
		
		
		
		JPanel tipPanel = new JPanel();
		tipPanel.setLayout(new FlowLayout(FlowLayout.RIGHT,0,0));
		tipPanel.setBackground(Color.LIGHT_GRAY);
		tipPanel.add(scrollPaneTip);
		tipPanel.add(new JLabel("               "));
		
		JPanel headPanel = new JPanel();
		headPanel.setLayout(new BorderLayout());
		headPanel.setBackground(Color.LIGHT_GRAY);
		headPanel.add(menuPanel, BorderLayout.WEST);
		headPanel.add(tipPanel, BorderLayout.EAST);
		headPanel.add(new JLabel(" "), BorderLayout.SOUTH);
		headPanel.add(new JLabel(" "), BorderLayout.NORTH);

		
		logoPanel = new JPanel();
		logoPanel.setLayout(new BorderLayout());
		logoPanel.setBackground(Color.LIGHT_GRAY);
		logoPanel.add(logoBtn, BorderLayout.WEST);
		
		JPanel spacePanel1 = new JPanel();
		spacePanel1.setLayout(new BorderLayout());
		spacePanel1.setBackground(Color.LIGHT_GRAY);
		spacePanel1.add(new JLabel(" "), BorderLayout.SOUTH);
		
		JPanel spacePanel2 = new JPanel();
		spacePanel2.setLayout(new BorderLayout());
		spacePanel2.setBackground(Color.LIGHT_GRAY);
		spacePanel2.add(new JLabel(" "), BorderLayout.SOUTH);
		
		JPanel spacePanel3 = new JPanel();
		spacePanel3.setLayout(new BorderLayout());
		spacePanel3.setBackground(Color.LIGHT_GRAY);
		spacePanel3.add(new JLabel(" "), BorderLayout.SOUTH);
		
		JPanel hPanel = new JPanel();
		hPanel.setLayout(new BorderLayout());
		hPanel.setBackground(Color.LIGHT_GRAY);
		hPanel.add(searchTextField, BorderLayout.CENTER);
        hPanel.add(searchBtn, BorderLayout.EAST);
		
		
		
        headerPanel = new JPanel();
        headerPanel.setLayout(new BorderLayout());
      	headerPanel.setBorder(empty);
        headerPanel.setBackground(Color.LIGHT_GRAY);
        headerPanel.add(headPanel, BorderLayout.NORTH);
        headerPanel.add(hPanel, BorderLayout.CENTER);
        headerPanel.add(new JLabel("               "), BorderLayout.EAST);
        headerPanel.add(new JLabel("            "), BorderLayout.WEST);
		

		
		JPanel mainHeaderPanel = new JPanel();
		mainHeaderPanel.setLayout(new BorderLayout());
		//mainHeaderPanel.add(logoPanel, BorderLayout.EAST);
		mainHeaderPanel.add(headerPanel, BorderLayout.CENTER);
	
		outputPanel = new JPanel();
		outputPanel.setLayout(new BorderLayout());		
        outputPanel.setBackground(Color.LIGHT_GRAY);
        outputPanel.add(scrollPaneBody, BorderLayout.CENTER);
        outputPanel.add(spacePanel1, BorderLayout.NORTH);
        outputPanel.add(new JLabel("            "), BorderLayout.WEST);
        outputPanel.add(new JLabel("                "), BorderLayout.EAST);
        
        
        JPanel footPanel = new JPanel();
        footPanel.setLayout(new BorderLayout());
        footPanel.setBackground(Color.LIGHT_GRAY);
        footPanel.add(new JLabel("            "), BorderLayout.WEST);
        footPanel.add(indexPanel, BorderLayout.CENTER);
        footPanel.add(clearBtn, BorderLayout.EAST);
        
        
        
        footerPanel = new JPanel();
        footerPanel.setLayout(new BorderLayout());
        footerPanel.setBackground(Color.LIGHT_GRAY);
        footerPanel.add(new JLabel("                "), BorderLayout.EAST);
        footerPanel.add(footPanel, BorderLayout.CENTER);
        footerPanel.add(spacePanel2, BorderLayout.SOUTH);
        footerPanel.add(spacePanel3, BorderLayout.NORTH);
		
		
		
	
		
        setLayout(new BorderLayout());
		add(mainHeaderPanel, BorderLayout.NORTH);	
		add(outputPanel, BorderLayout.CENTER);
		add(footerPanel,BorderLayout.SOUTH);
			
		

    }

    	public static void main(String[] args) {
		JFrame frame = new ITdictionary();

		frame.setTitle("Clamt IT Dictionary");
		frame.pack();
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setLocationRelativeTo(null);
		frame.setVisible(true);

	}
         class CursorListener implements MouseListener{

		public void mouseReleased(MouseEvent me){
			//not used
		}
		public void mousePressed(MouseEvent me){
			//not used
		}
		public void mouseEntered(MouseEvent me){
			//not used
		}
		public void mouseExited(MouseEvent me){
			//not used
		}
		public void mouseClicked(MouseEvent me){
			searchTextField.selectAll();
		}
	}


}
